gboolean
ot_admin_builtin_cleanup (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
{
gboolean ret = FALSE;
const char *refspec;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
GKeyFile *origin = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
out:
if (origin)
g_key_file_unref (origin);
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ot_admin_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
glnx_unref_object OstreeDeployment *deployment = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ot_admin_builtin_init_fs (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
glnx_fd_close int root_dfd = -1;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
if (!subcommand->name)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
g_autofree char *help;
context = ostree_admin_instutil_option_context_new_with_commands ();
help = g_option_context_get_help (context, FALSE, NULL);
g_printerr ("%s", help);
- g_option_context_free (context);
-
goto out;
}
gboolean
ot_admin_builtin_os_init (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
const char *osname = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ot_admin_builtin_set_origin (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
const char *remotename = NULL;
const char *url = NULL;
const char *branch = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ot_admin_builtin_status (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
gboolean ret = FALSE;
glnx_unref_object OstreeRepo *repo = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
const char *new_provided_refspec = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
out:
if (new_origin)
g_key_file_unref (new_origin);
- if (context)
- g_option_context_free (context);
return ret;
}
ot_admin_builtin_undeploy (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
const char *deploy_index_str;
int deploy_index;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ot_admin_builtin_unlock (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
OstreeDeployment *booted_deployment = NULL;
OstreeDeploymentUnlockedState target_state;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ot_admin_builtin_upgrade (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
glnx_unref_object OstreeSysrootUpgrader *upgrader = NULL;
g_autoptr(GKeyFile) origin = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
{
gboolean ret = FALSE;
guint bootversion;
- GOptionContext *context = NULL;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
context = g_option_context_new ("[BOOTVERSION] - generate GRUB2 configuration from given BLS entries");
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
glnx_unref_object OstreeSePolicy *sepolicy = NULL;
g_autoptr(GPtrArray) deployments = NULL;
OstreeDeployment *first_deployment;
- GOptionContext *context = NULL;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
g_autoptr(GFile) deployment_path = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
guint i;
g_autoptr(GPtrArray) deployments = NULL;
OstreeDeployment *first_deployment = NULL;
- GOptionContext *context = NULL;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
if (!subcommand->name)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
g_autofree char *help;
context = ostree_admin_option_context_new_with_commands ();
help = g_option_context_get_help (context, FALSE, NULL);
g_printerr ("%s", help);
- g_option_context_free (context);
-
goto out;
}
gboolean
ostree_builtin_cat (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
int i;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ostree_builtin_checkout (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *commit;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ostree_builtin_checksum (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
gboolean ret = FALSE;
g_autoptr(GFile) f = NULL;
AsyncChecksumData data = { 0, };
out:
if (data.loop)
g_main_loop_unref (data.loop);
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
gboolean skip_commit = FALSE;
out:
if (repo)
ostree_repo_abort_transaction (repo, cancellable, NULL);
- if (context)
- g_option_context_free (context);
if (modifier)
ostree_repo_commit_modifier_unref (modifier);
return ret;
gboolean
ostree_builtin_config (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context = NULL;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *op;
out:
if (config)
g_key_file_free (config);
- if (context)
- g_option_context_free (context);
return ret;
}
ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *src;
const char *target;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ostree_builtin_export (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *rev;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ostree_builtin_fsck (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
GHashTableIter hash_iter;
gpointer key, value;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ostree_builtin_gpg_sign (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
g_autofree char *resolved_commit = NULL;
const char *commit;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
-
return ret;
}
gboolean
ostree_builtin_init (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context = NULL;
+ g_autoptr(GOptionContext) context = NULL;
g_autoptr(OstreeRepo) repo = NULL;
gboolean ret = FALSE;
OstreeRepoMode mode;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
GCancellable *cancellable,
GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *rev;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ostree_builtin_ls (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *rev;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ostree_builtin_prune (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
g_autofree char *formatted_freed_size = NULL;
OstreeRepoPruneFlags pruneflags = 0;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
int i;
const char *src_repo_arg;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
if (repo)
ostree_repo_abort_transaction (repo, cancellable, NULL);
return ret;
gboolean
ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
g_autofree char *remote = NULL;
out:
if (signal_handler_id > 0)
g_signal_handler_disconnect (repo, signal_handler_id);
- if (context)
- g_option_context_free (context);
return ret;
}
ostree_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
int i;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
if (repo)
ostree_repo_abort_transaction (repo, cancellable, NULL);
return ret;
if (!subcommand->name)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
g_autofree char *help;
context = remote_option_context_new_with_commands ();
help = g_option_context_get_help (context, FALSE, NULL);
g_printerr ("%s", help);
- g_option_context_free (context);
-
goto out;
}
GCancellable *cancellable,
GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
g_autoptr(GHashTable) known_refs = NULL;
gboolean ret = FALSE;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
if (repo)
ostree_repo_abort_transaction (repo, cancellable, NULL);
return ret;
gboolean
ostree_builtin_rev_parse (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *rev = "master";
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean
ostree_builtin_show (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
gboolean ret = FALSE;
const char *rev;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean ret = FALSE;
g_autoptr(GPtrArray) delta_names = NULL;
guint i;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
context = g_option_context_new ("LIST - list static delta files");
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ot_static_delta_builtin_show (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *delta_id = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ot_static_delta_builtin_delete (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *delta_id = NULL;
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ot_static_delta_builtin_generate (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
context = g_option_context_new ("GENERATE [TO] - Generate static delta files");
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
gboolean ret = FALSE;
const char *patharg;
g_autoptr(GFile) path = NULL;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
context = g_option_context_new ("APPLY-OFFLINE - Apply static delta file");
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ostree_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
context = g_option_context_new ("Manage summary metadata");
ret = TRUE;
out:
- if (context)
- g_option_context_free (context);
return ret;
}
ostree_usage (OstreeCommand *commands,
gboolean is_error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
g_autofree char *help;
context = ostree_option_context_new_with_commands (commands);
else
g_print ("%s", help);
- g_option_context_free (context);
-
return (is_error ? 1 : 0);
}
if (!command->fn)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
g_autofree char *help;
context = ostree_option_context_new_with_commands (commands);
help = g_option_context_get_help (context, FALSE, NULL);
g_printerr ("%s", help);
- g_option_context_free (context);
-
goto out;
}
gboolean
ot_remote_builtin_add_cookie (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *remote_name;
const char *domain;
/* jar takes ownership of cookie */
soup_cookie_jar_add_cookie (jar, cookie);
- if (context)
- g_option_context_free (context);
return TRUE;
}
gboolean
ot_remote_builtin_add (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *remote_name;
const char *remote_url;
ret = TRUE;
out:
- g_option_context_free (context);
-
return ret;
}
gboolean
ot_remote_builtin_delete_cookie (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *remote_name;
const char *domain;
if (!found)
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Cookie not found in jar");
- if (context)
- g_option_context_free (context);
return found;
}
gboolean
ot_remote_builtin_delete (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *remote_name;
gboolean ret = FALSE;
ret = TRUE;
out:
- g_option_context_free (context);
-
return ret;
}
gboolean
ot_remote_builtin_gpg_import (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
g_autoptr(GInputStream) source_stream = NULL;
const char *remote_name;
ret = TRUE;
out:
- g_option_context_free (context);
-
return ret;
}
gboolean
ot_remote_builtin_list_cookies (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *remote_name;
g_autofree char *jar_path = NULL;
gboolean
ot_remote_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
g_auto(GStrv) remotes = NULL;
guint ii, n_remotes = 0;
ret = TRUE;
out:
- g_option_context_free (context);
-
return ret;
}
gboolean
ot_remote_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *remote_name;
gboolean ret = FALSE;
}
ret = TRUE;
-
out:
- g_option_context_free (context);
-
return ret;
}
gboolean
ot_remote_builtin_summary (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- GOptionContext *context;
+ g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeRepo *repo = NULL;
const char *remote_name;
g_autoptr(GBytes) summary_bytes = NULL;
}
ret = TRUE;
-
out:
- g_option_context_free (context);
-
return ret;
}